package com.kystar.muxplayer.protocol.code.get;

import android.graphics.Rect;
import android.icu.text.CollationKey.BoundMode;
import com.kystar.muxplayer.model.Bound;
import com.kystar.muxplayer.model.LayerType;
import com.kystar.muxplayer.protocol.CodeCmd;

//    1	图像参数
//    2	局部参数
//    3	抠图
//    4	边缘羽化
//    5	透明度
public class CG8C_LayerParam extends CodeCmd {

    private CG8C_LayerParam(int windowId, int type) {
        super( windowId, type);
    }

    @Override
    public byte getCode() {
        return (byte) 0x8C;
    }

    public Bound getBound() {
        return new Bound(mResult[2] << 8 & 0xFF00 | mResult[3] & 0xFF,
            mResult[4] << 8 & 0xFF00 | mResult[5] & 0xFF,
            mResult[6] << 8 & 0xFF00 | mResult[7] & 0xFF,
            mResult[8] << 8 & 0xFF00 | mResult[9] & 0xFF);
    }

    public int getInt() {
        return mResult[2] & 0xff;
    }


    public static CG8C_LayerParam createRect(LayerType type) {
        return new CG8C_LayerParam( type.id, 1);
    }

    public static CG8C_LayerParam createClip(LayerType type) {
        return new CG8C_LayerParam(type.id, 2);
    }

    public static CG8C_LayerParam createCutout(LayerType type) {
        return new CG8C_LayerParam( type.id, 3);
    }

    public static CG8C_LayerParam createFeather(LayerType type) {
        return new CG8C_LayerParam(type.id, 4);
    }

    public static CG8C_LayerParam createAlpha(LayerType type) {
        return new CG8C_LayerParam( type.id, 5);
    }
}
